import {UseInterceptor, Action, Req, Res} from "routing-controllers";
import { TableNameInMiddleware } from "../../middleware/TableNameInMiddleware";
import UserDao  from "../../dao/UserDao"
import { Service } from "typedi";
import { UserService } from "../UserService";

@Service()
export class UserServiceImpl implements UserService{
  /**
   * 发送短信验证码
   * @param params
   * {
   *   userphone: 手机号
   * }
   * @constructor
   */
  public async userSmsCodeService (params:Object): Promise<Object> {
    return await UserDao.sendSmsCode(params);
  }

  /**
   * 手机号登录
   * @param params
   * @param session
   */
  @TableNameInMiddleware("_User")
  public async userLoginByMobilePhone(params: Object, session?: any): Promise<Object> {
    return await UserDao.loginSms(params);
  }

  /**
   * 用户注册
   * @param params
   */
  @TableNameInMiddleware("_User")
  public async userRegisterService(params: Object): Promise<Object> {
    return await UserDao.userRegister(params);
  }




}